package agentspeakide.editors;

import java.text.MessageFormat;

import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ContextInformation;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;

public class ASLContentAssistProcessor implements IContentAssistProcessor {

	
	public final static String[] KEYWORDS =
	new String[] {"ally_pos", "cell", "corral", "cow", "find_pos", "gsize", "line_of_sight", "move", "moveTo",
		"opponent", "opponent_pos", "pos", "print", "search_cows", "steps", "target", "wait"};

	//Preenche a tabela do auto-complete com as palavras chave
	@Override
	public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset){

		ICompletionProposal[] result= new ICompletionProposal[KEYWORDS.length];
		for (int i= 0; i < KEYWORDS.length; i++) {
			IContextInformation info= new ContextInformation(KEYWORDS[i], MessageFormat.format("teste", new Object[] { KEYWORDS[i] }));
			result[i]= new CompletionProposal(KEYWORDS[i], documentOffset, 0, KEYWORDS[i].length(), null, KEYWORDS[i], info, MessageFormat.format("teste", new Object[] { KEYWORDS[i]}));
		}

		return result;
	}

	@Override
	public IContextInformation[] computeContextInformation(ITextViewer arg0,
			int arg1) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public char[] getCompletionProposalAutoActivationCharacters() {
		// TODO Auto-generated method stub
		return new char[] {'.'};
	}

	@Override
	public char[] getContextInformationAutoActivationCharacters() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public IContextInformationValidator getContextInformationValidator() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getErrorMessage() {
		// TODO Auto-generated method stub
		return null;
	}

}
